package com.laiketui.plugin.common.interfaces;

import com.laiketui.plugin.common.domain.MainVo;
import com.laiketui.plugin.common.domain.base.user.UserAddress;
import com.laiketui.plugin.common.domain.vo.AdminOrderListVo;
import com.laiketui.plugin.common.domain.vo.OrderSettlementVo;
import com.laiketui.plugin.common.domain.vo.OrderVo;
import com.laiketui.plugin.common.domain.vo.order.AdminOrderDetailVo;
import com.laiketui.plugin.common.domain.vo.order.OrderModifyVo;
import com.laiketui.plugin.common.domain.vo.sec.AdminDeliveryVo;
import com.laiketui.plugin.common.domain.vo.sec.EditOrderVo;
import com.laiketui.core.exception.LaiKeAPIException;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 订单通用服务
 *
 * @author wangxian
 */
public interface PublicOrderService {

    /**
     * 获取订单结算列表
     *
     * @param vo-
     * @return Map
     * @throws LaiKeAPIException-
     * @author Trick
     * @date 2021/7/27 19:08
     */
    Map<String, Object> getSettlementOrderList(OrderSettlementVo vo) throws LaiKeAPIException;


    /**
     * 订单列表（pc后台）
     * 【php DeliveryHelper.order_index】
     *
     * @param vo -
     * @return Map
     * @throws LaiKeAPIException -
     * @author Trick
     * @date 2021-07-19 15:03:25
     */
    Map<String, Object> pcMchOrderIndex(AdminOrderListVo vo) throws LaiKeAPIException;

    /**
     * 统一修改订单状态
     * 【如果明细都是一个状态，则修正主表状态】
     *
     * @param storeId -
     * @param orderno -
     * @throws LaiKeAPIException -
     * @author Trick
     * @date 2020/11/27 11:21
     */
    void updateOrderState(int storeId, String orderno) throws LaiKeAPIException;


    /**
     * 创建订单号码
     *
     * @param orderType
     * @return
     */
    String createOrderNo(String orderType);

    /**
     * 计算运费
     *
     * @param freightMap
     * @param products
     * @param userAddress
     * @param storeId
     * @param productType
     * @return
     */
    Map<String, Object> getFreight(Map<String, List<Map<String, Object>>> freightMap, List<Map<String, Object>> products, UserAddress userAddress, int storeId, String productType);

    /**
     * 计算运费
     * 【根据商品设置的运费模板计算运费】
     *
     * @param goodsAddressId - 商品运费模板id
     * @param userAddress    - 当前用户选择的运费模型数据 - 可选
     * @return BigDecimal
     * @throws LaiKeAPIException -
     * @author Trick
     * @date 2021/3/26 18:15
     */
    BigDecimal getFreight(Integer goodsAddressId, UserAddress userAddress) throws LaiKeAPIException;

    /**
     * 计算运费
     * 【根据商品设置的运费模板计算运费】
     *
     * @param goodsAddressId - 商品运费模板id
     * @param userAddress    - 当前用户选择的运费模型数据 - 可选
     * @param productNum     - 商品件数
     * @param weightNum      - 商品重量
     * @return BigDecimal
     * @throws LaiKeAPIException -
     * @author Trick
     * @date 2021/3/26 18:15
     */
    BigDecimal getFreight(Integer goodsAddressId, UserAddress userAddress, int productNum, BigDecimal weightNum) throws LaiKeAPIException;

    /**
     * 发货
     * 【php DeliveryHelper.frontDelivery】
     *
     * @param vo             -
     * @param exId           -
     * @param exNo           -
     * @param orderDetailIds -
     * @throws LaiKeAPIException -
     * @author Trick
     * @date 2020/11/26 16:43
     */
    void adminDelivery(MainVo vo, Integer exId, String exNo, String orderDetailIds) throws LaiKeAPIException;

    /**
     * 订单发货
     *
     * @param vo             -
     * @param exId           -
     * @param exNo           -
     * @param orderDetailIds -
     * @throws LaiKeAPIException -
     * @author Administrator
     * @date 2021/8/2 14:42
     */
    void deliverySave(MainVo vo, Integer exId, String exNo, String orderDetailIds) throws LaiKeAPIException;


    /**
     * 保存编辑订单
     *
     * @param orderVo -
     * @throws LaiKeAPIException -
     * @author Trick
     * @date 2021/8/2 10:21
     */
    void saveEditOrder(EditOrderVo orderVo) throws LaiKeAPIException;


    /**
     * 进入发货界面
     *
     * @param adminDeliveryVo -
     * @return Map
     * @throws LaiKeAPIException-
     * @author Trick
     * @date 2022-01-12 19:17:30
     */
    Map<String, Object> deliveryView(AdminDeliveryVo adminDeliveryVo) throws LaiKeAPIException;


    /**
     * 搜索快递公司
     *
     * @param express -
     * @return Map
     * @throws LaiKeAPIException-
     * @author Trick
     * @date 2022-01-12 19:17:30
     */
    Map<String, Object> searchExpress(String express) throws LaiKeAPIException;


    /**
     * 后台订单详情接口
     *
     * @param adminOrderVo
     * @return
     * @throws LaiKeAPIException
     */
    Map<String, Object> orderPcDetails(AdminOrderDetailVo adminOrderVo) throws LaiKeAPIException;


    /**
     * 根据订单号获取物流信息
     *
     * @param orderNo -
     * @return Map
     * @throws LaiKeAPIException -
     * @author Trick
     * @date 2020/12/15 9:39
     */
    Map<String, Object> getLogistics(String orderNo) throws LaiKeAPIException;


    /**
     * 平台订单详情
     *
     * @param orderVo
     * @return
     */
    Map<String, Object> orderDetailsInfo(AdminOrderDetailVo orderVo);


    /**
     * 编辑订单界面
     *
     * @param orderVo
     * @return
     * @throws LaiKeAPIException
     */
    Map<String, Object> editOrderView(OrderModifyVo orderVo) throws LaiKeAPIException;


    /**
     * 获取订单物流信息
     *
     * @param vo      -
     * @param orderno -
     * @return Map
     * @throws LaiKeAPIException -
     * @author Trick
     * @date 2021/6/4 15:29
     */
    Map<String, Object> kuaidishow(MainVo vo, String orderno) throws LaiKeAPIException;

    /**
     * 积分订单详情 h5
     *
     * @param vo -
     * @return Map
     * @throws LaiKeAPIException-
     * @author Trick
     * @date 2022/1/18 11:11
     */
    Map<String, Object> orderList(OrderVo vo) throws LaiKeAPIException;

    /**
     * 订单详情/订单列表-确认收货
     *
     * @param vo       -
     * @param tokenKey - 登录模块key
     * @param orderNo  -
     * @param rType    -退货状态
     * @return Map
     * @throws LaiKeAPIException -
     * @author wang xian
     * @date 2021/4/6 10:23
     */
    Map<String, Object> okOrder(MainVo vo, String tokenKey, String orderNo, Integer rType) throws LaiKeAPIException;

    /**
     * 订单详情/订单列表-确认收货
     *
     * @param storeId  -
     * @param accessId -
     * @param orderno  -
     * @param rType    -退货状态
     * @return Map
     * @throws LaiKeAPIException -
     * @author wang xian
     * @date 2021/4/6 10:23
     */
    Map<String, Object> okOrder(int storeId, String accessId, String orderno, Integer rType) throws LaiKeAPIException;

    /**
     * 根据订单类型获取订单配置
     * 【插件订单配置请传店铺id】
     *
     * @param storeId -
     * @param oType   -  订单类型
     * @return Map
     * @throws LaiKeAPIException-
     * @author sunH
     * @date 2023/06/14 10:23
     */
    Map<String, Object> getOrderConfig(int storeId, String oType) throws LaiKeAPIException;

    /**
     * 根据订单类型获取订单配置
     *
     * @param storeId -
     * @param mchId   -
     * @param oType   -
     * @return Map
     * @throws LaiKeAPIException-
     * @author sunH
     * @date 2023/06/14 10:23
     */
    Map<String, Object> getOrderConfig(int storeId, Integer mchId, String oType) throws LaiKeAPIException;

    /**
     * annotation
     * 【php xx.xx】
     *
     * @param storeId -
     * @param mchId   -
     * @param oType   -
     * @param isOpen  - 是否只获取开启插件的配置
     * @return Map
     * @throws LaiKeAPIException-
     * @author sunH
     * @date 2023/06/14 10:23
     */
    Map<String, Object> getOrderConfig(int storeId, Integer mchId, String oType, boolean isOpen) throws LaiKeAPIException;


    /**
     * 判断用户、商家、平台是否都已经删除订单
     * @param storeId
     * @param sNo
     * @return Boolean
     * gp
     * 2023-12-05
     */
    Boolean allDelOrder(int storeId, String sNo)throws LaiKeAPIException;
}
